var express = require('express');
var router = express.Router();
var luosimao = require("../utils/luosimao");

/* home page. */
router.get('/', function (req, res) {
    res.render('index');
});
//注册页
router.get('/register',function(req,res){
    res.render('register');
});
//注册提交
router.post('/register',function(req,res){
    var phone=req.body.phonenum;
    var pwd=req.body.password;
    var code=req.body.code;
    console.log(phone+"-"+pwd+"-"+code+"-");
});
//注册页发送验证码
router.post('/sendsms',function(req,res){
    var phone=req.body.phone;
    function addNumber(_idx){
        var str = '';
        for(var i = 0; i < _idx; i += 1){
            str += Math.floor(Math.random() * 10);
        }
        return str;
    }
    var num=addNumber(6);
    var msg="极其美好账号注册手机验证码："+num+" 【极其美好】";
    //luosimao.sms(phone,msg);
    res.send(num);
});

//外包服务
router.get('/outsourcing',function(req,res){
    res.render('outsourcing');
});
router.get('/service',function(req,res){
    res.render('service');
});
router.get('/example',function(req,res){
    res.render('example');
});

module.exports = router;
